package com.jiaquyun.jcyx.jetpack.api

import com.jiaquyun.jcyx.base.BaseManager
import com.jiaquyun.jcyx.entity.ArticleDetailsResponse
import com.jiaquyun.jcyx.entity.ArticleListResponse
import rxhttp.RxHttp
import rxhttp.await

class ArticleRepository : BaseManager() {

    /**
     * 文章列表
     *
     * @param type 类型
     * */
    suspend fun articleList(type: String): ArticleListResponse =
        RxHttp.postForm("/api/article/articleList")
            .add("type", type)
            .await()

    /**
     * 文章详情
     *
     * @param id 文章列表id
     * */
    suspend fun articleDetails(id: String): ArticleDetailsResponse =
        RxHttp.postForm("/api/article/detail")
            .add("id", id)
            .await()
}